From 1adfbe0d0225818348b1cec8b04eaeba657315bb Mon Sep 17 00:00:00 2001 From: Robert Lipe Date: Mon, 30 Jul 2018 19:29:14 -0500 Subject: [PATCH] Fix crash in -^ generating doc list MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit vecs_t is no longer a struct of POD. It’s now a class and has to be allocated by new. I hope to not have to rathole in vets for this change because it’s full of scary memory management like this. --- vecs.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/vecs.cc b/vecs.cc index f04bfd74d..b4c2d4a73 100644 --- a/vecs.cc +++ b/vecs.cc @@ -23,6 +23,8 @@ #include "csv_util.h" #include "gbversion.h" #include "inifile.h" +#include "QtCore/QDebug" +#include #include #include // qsort @@ -1483,7 +1485,7 @@ sort_and_unify_vecs(int* ctp) /* Walk the style list, parse the entries, dummy up a "normal" vec */ for (style_vecs_t* svec = style_list; svec->name; svec++, i++) { xcsv_read_internal_style(svec->style_buf); - svp[i] = (vecs_t*) xcalloc(1, sizeof** svp); + svp[i] = new vecs_t; svp[i]->name = svec->name; svp[i]->vec = (ff_vecs_t*) xmalloc(sizeof(*svp[i]->vec)); svp[i]->extensions = xcsv_file.extension; @@ -1677,7 +1679,6 @@ disp_formats(int version) vecs_t** svp; vecs_t* vec; int vc = 0; - switch (version) { case 0: case 1: @@ -1701,7 +1702,7 @@ disp_formats(int version) disp_v2(vec->vec); } printf("%s\t%s\t%s%s%s\n", vec->name, - CSTR(vec->extensions) ? CSTR(vec->extensions) : "", + !vec->extensions.isEmpty() ? CSTR(vec->extensions) : "", CSTR(vec->desc), version >= 3 ? "\t" : "", version >= 3 ? vec->parent : ""); -- 2.30.2